import time

def sort(nums):
    S= len(nums) - 1
   
    for i in range(S):
        QQQ=False
        for j in range(S- i):
            if nums[j] > nums[j + 1]:
                nums[j], nums[j + 1] = nums[j + 1], nums[j]
                QQQ= True
        if not QQQ:
            break

def read(f):
    with open(f, 'r',encoding="UTF-8") as file:
        return [int(line) for line in file]


filenames = ["m1_sorted.txt", "m2_reverse.txt", "m3_shuffle.txt"]

for f in filenames:
    N= read(f)
    start = time.time()
    sort(N)
    end = time.time()
    print(f.split('.')[0], round((end - start) * 1000), "milliseconds")
